<template>
  <router-link :to="{name: routeNamePrefix+routeName,params: {id: bid}}">
    <el-button v-waves :class="className" :type="type" :icon="icon">
      <span v-if="$slots.default"><slot></slot></span>
      <span v-else>{{getSlot}}</span>
    </el-button>
  </router-link>
</template>
<script>
  export default {
    props: {
      //业务id
      bid: {
        type: [Object, String, Number],
        default: null
      },
      routeNamePrefix: {
        type: String,
        default: ''
      },
      routeName: {
        type: String,
        default: '404'
      },
      type: {
        type: String,
        default: 'primary'
      },
      icon: {
        type: String,
        default: ''
      },
      className: {
        type: String,
        default: ''
      },
      // label: {
      //   type: String,
      //   default: "添加"
      // },
    },
    methods: {},
    computed: {
      getSlot() {
        if (this.routeName === "Edit") {
          return "修改"
        } else if (this.routeName === "Add") {
          return "添加"
        } else if (this.routeName === "Detail") {
          return "详情"
        } else if (this.routeName === "Del") {
          return "删除"
        }
        return "未判断"
      }
    }
  }
</script>
